<template>
    <trading-rank-refine :stock="state.stock" :key="state.stock"></trading-rank-refine>
</template>

<script setup>
// 个股周数据详情页
import { reactive, watch } from 'vue';
import { weekStockSearch } from '../stores/week'
import { storeToRefs } from 'pinia';
import TradingRankRefine from './TradingRankRefine.vue';
import { useRouteQuery } from '../utils/useRoute';

const stockSearchStore = weekStockSearch()
let { input } = storeToRefs(stockSearchStore)

const baseKey = "tradingRank"

let stock = useRouteQuery("stock","")
if(stock) {
    input.value = stock
}

const state = reactive({
    stock: input.value,
})

// 只监听pinia中某一个值的变化
watch(() => input.value, (newValue, oldValue) => {
    state.stock = newValue
})
</script>